package com.some;

import java.util.Scanner;

public class QiAnXin02 {
    int maxVal = 0;

    public int maxS(int[] nums) {
        for (int i = 0; i < nums.length; i++) {
            for (int j = i + 1; j < nums.length; j++) {
                maxVal = Math.max(maxVal, (j - i) * Math.min(nums[i], nums[j]));
            }
        }
        return maxVal;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        str = str.replace("[", "");
        str = str.replace("]", "");
        String[] split = str.split(",");
        int[] nums = new int[split.length];
        for (int i = 0; i < split.length; i++) {
            nums[i] = Integer.parseInt(split[i]);
        }
        QiAnXin02 qiAnXin02 = new QiAnXin02();
        System.out.println(qiAnXin02.maxS(nums));
    }
}
